import { ProFormSelect, ProForm } from '@ant-design/pro-form';
import TableSelect from '../TableSelect'
import { getInfoData } from '../TableSelect/service';
import React from 'react';
class EditBox extends React.Component {
    constructor(props: { columnId: string }) {
        super(props);
    }

    render() {
        return (
            <>
                <ProForm.Item
                    name="object"
                    label="选择资源"
                >
                    <TableSelect ProTableProps={
                        {
                            rowKey: "id",
                            columns: [
                                {
                                    title: 'id',
                                    width: 70,
                                    dataIndex: 'id',
                                    search: false,
                                    ellipsis: true,
                                },
                                {
                                    title: '标题',
                                    dataIndex: 'title',
                                    search: false,
                                    ellipsis: true,
                                },
                                {
                                    title: '描述',
                                    dataIndex: 'describe',
                                    search: false,
                                    ellipsis: true,
                                },
                            ],
                            pagination: { pageSize: 5 },
                            request: (param: any) => {
                                try {
                                    return getInfoData({ ...param, 'column_id': this.props?.columnId })
                                } catch (error) {
                                    console.log(error);
                                    return []
                                }
                            }
                        }
                    } />
                </ProForm.Item>
                <ProFormSelect
                    width="md"
                    request={async () => [
                        { label: '上架', value: 1 },
                        { label: '暂不上架', value: 2 },
                    ]}
                    rules={[
                        {
                            required: true,
                        },
                    ]}
                    name="status"
                    label="状态"
                />

            </>
        );
    }
}



export default EditBox